home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Apps / AudioApps / CSound.app / manual / g7.pluck < prev    next >
Encoding:
Text File  |  1992-12-21  |  2.9 KB  |  78 lines

  1.  
  2. .nf
  3.     ar    \fBpluck\fR    kamp, kcps, icps, ifn, imeth [, iparm1, iparm2]
  4. .fi
  5.  
  6. Audio output is a naturally decaying plucked string or drum sound based on the
  7. Karplus-Strong algorithms.
  8.  
  9. INITIALIZATION
  10.  
  11. \fIicps\fR - intended pitch value in cps, used to set up a buffer of
  12. 1 cycle of audio samples
  13. which will be smoothed over time by a chosen decay method.
  14. \fIicps\fR normally anticipates the value of \fIkcps\fR, but may be set
  15. artificially high or low to influence the size of the sample buffer.
  16.  
  17. \fIifn\fR - table number of a stored function used to initialize the cyclic
  18. decay buffer.  If \fIifn\fR = 0, a random sequence will be used instead.
  19.  
  20. \fIimeth\fR - method of natural decay.  There are six, some of which use
  21. parameters values that follow.
  22. .sp .5
  23. .in 3
  24. .ti -2
  25. 1 - simple averaging.  A simple smoothing process, uninfluenced by
  26. parameter values.
  27. .br
  28. .ti -2
  29. 2 - stretched averaging.  As above, with smoothing time stretched
  30. by a factor of \fIiparm1\fR ( >= 1 ).
  31. .br
  32. .ti -2
  33. 3 - simple drum.  The range from pitch to noise is controlled by a 'roughness
  34. factor' in \fIiparm1\fR (0 to 1).  Zero gives the plucked string effect,
  35. while 1 reverses the polarity of every sample (octave down, odd harmonics).
  36. The setting .5 gives an optimum snare drum.
  37. .br
  38. .ti -2
  39. 4 - stretched drum.  Combines both roughness and stretch factors.
  40. \fIiparm1\fR is roughness (0 to 1),
  41. and \fIiparm2\fR the stretch factor ( >= 1 ).
  42. .br
  43. .ti -2
  44. 5 - weighted averaging.  As method 1, with \fIiparm1\fR weighting the
  45. current sample (the status quo) and \fIiparm2\fR weighting the previous
  46. adjacent one.  \fIiparm1 + iparm2\fR must be <= 1.
  47. .br
  48. .ti -2
  49. 6 - 1st order recursive filter, with coefs .5.  Unaffected by parameter values.
  50.  
  51. .in 0
  52. \fIiparm1, iparm2\fR (optional) - parameter values for use by the
  53. smoothing algorithms (above).  The default values are both 0.
  54.  
  55. PERFORMANCE
  56.  
  57. An internal audio buffer, filled at I-time according to \fIifn\fR,
  58. is continually resampled with periodicity \fIkcps\fR and the resulting
  59. output is multiplied by \fIkamp\fR.  Parallel with the sampling, the
  60. buffer is smoothed to simulate the effect of natural decay.
  61.  
  62. Plucked strings (1,2,5,6) are best realized by starting with a random
  63. noise source, which is rich in initial harmonics.
  64. Drum sounds (methods 3, 4) work best with a flat source (wide pulse),
  65. which produces a deep noise attack and sharp decay.
  66.  
  67. The original Karplus-Strong algorithm used a fixed number of samples
  68. per cycle, which caused serious quantization of the pitches available and
  69. their intonation.  This implementation resamples a buffer at the exact pitch
  70. given by \fIkcps\fR, which can be varied for vibrato and glissando effects.
  71. For low values of the orch sampling rate (e.g. \fIsr\fR = 10000),
  72. high frequencies will store only very few samples ( = \fIsr/icps\fR).
  73. Since this may cause noticeable noise in the resampling process,
  74. the internal buffer has a minimum size of 64 samples.
  75. This can be further enlarged by setting \fIicps\fR to some
  76. artificially lower pitch.
  77. .bp
  78.